﻿using System;
using Abp.Authorization.Users;
using Abp.Extensions;
using FwProject.Core.FactoryInfo;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
namespace FwProject.Authorization.Users
{
    public class User : AbpUser<User>
    {
        public const string DefaultPassword = "123qwe";
        public const string TempFileUrlPrefix = FwConsts.TempFileUrlPrefix + "faces/";
        public const string SaveFileUrlPrefix = FwConsts.SaveFileUrlPrefix + "faces/";

        public static string CreateRandomPassword()
        {
            return Guid.NewGuid().ToString("N").Truncate(16);
        }
     
        public Guid? FactoryinfoId { get; set; }
        [ForeignKey("FactoryinfoId")]
        public FactoryNameInfo FactoryinfoModel { get; set; }
        //OpenId(手机扫码)
        public string OpenId_Code { get; set; }

        //OpenId(微信公众号)
        public string OpenId_Public { get; set; }

        public string Unionid { get; set; }

        public EmployeeType EmployeeType { get; set; } = EmployeeType.员工类型;
       
        public string Mobile { get; set; }
        public string Face { get; set; }
        public string NowAddress { get; set; }

        public static User CreateTenantAdminUser(int tenantId, string emailAddress)
        {
            var user = new User
            {
                TenantId = tenantId,
                UserName = AdminUserName,
                Name = AdminUserName,
                Surname = AdminUserName,
                EmailAddress = emailAddress
            };

            user.SetNormalizedNames();

            return user;
        }
    }
    public enum EmployeeType{
        [Display(Name = "工厂老板")]
        工厂老板=0,
        [Display(Name = "员工类型")]
        员工类型 =1,
        [Display(Name = "司机类型")]
        司机类型 =2,
        [Display(Name = "餐厅老板类型")]
        餐厅老板类型 = 3
    }
}
